package com.baizhi.service.impl;

import com.baizhi.dao.TagsStudentDAO;
import com.baizhi.entity.StudentTag;
import com.baizhi.service.TagsStudentService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class TagsStudentServiceImpl extends ServiceImpl<TagsStudentDAO, StudentTag> implements TagsStudentService {
    @Autowired
    private TagsStudentDAO tagsStudentDAO;

    @Override
    public List<StudentTag> queryAll(Long sid) {
        LambdaQueryWrapper<StudentTag> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(StudentTag::getSid, sid);
        List<StudentTag> studentTags = tagsStudentDAO.selectList(queryWrapper);
        return studentTags;
    }

    @Override
    public void add(StudentTag studentTag) {
        int insert = tagsStudentDAO.insert(studentTag);
    }
}
